package com.zy.sso.server.entites;

import java.time.LocalDateTime;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zy.sso.client.dto.login.ClientInfo;
import com.zy.sso.client.dto.login.LoginDTO;

/**
 * 设备信息追踪
 * **/
@Document(collection="sso_client_track")
public class ClientTrack extends ClientInfo {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	private String id;
	
	@Indexed
	private String gid;
	
	@Indexed
	private int status;//1 online, 0 offline
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
	@Indexed
	private LocalDateTime loginTime = LocalDateTime.now();
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
	private LocalDateTime loginOutTime;
	
	public static int STATUS_OFFLINE = 0;
	
	public static int STATUS_ONLINE = 1;

	private LoginDTO.OptType optType;

	public LoginDTO.OptType getOptType() {
		return optType;
	}

	public void setOptType(LoginDTO.OptType optType) {
		this.optType = optType;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getGid() {
		return gid;
	}

	public void setGid(String gid) {
		this.gid = gid;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public LocalDateTime getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(LocalDateTime loginTime) {
		this.loginTime = loginTime;
	}

	public LocalDateTime getLoginOutTime() {
		return loginOutTime;
	}

	public void setLoginOutTime(LocalDateTime loginOutTime) {
		this.loginOutTime = loginOutTime;
	}
	
	
	
	

}
